<template>
    <div class="register-left">
        <div class="logo-container">
          <router-link to="/">
            <img src="/logo.png" alt="LOGO" class="logo">
          </router-link>
        </div>
  <div class="register-box">
          
  <h2 class="register-title">新規会員登録</h2>
  <p class="register-subtitle">仮登録ありがとうございます</p>
   <strong style="text-align: center; display: block;">{{ email }}</strong>
  <div class="email-sent-container">
    <el-icon class="email-sent-icon"> <Promotion /></el-icon>
        <p class="email-login-subtext">登録確認コードがメールに送信されました</p>
    <!-- <h3 class="email-sent-title">{{ isEmailSending ? 'メールを送信中...' : 'メールが送信されました' }}</h3>
    <p class="email-sent-text">{{ isEmailSending ? 'メールを送信中...' : 'メールが送信されました' }} <strong>{{ email }}</strong></p>
    <p class="email-sent-subtext">{{ isEmailSending ? 'メールを送信中...' : 'メールが送信されました' }}</p> -->
    <p class="fontshow">メールで確認コードを確認し、下の「登録を続けるにはクリックしてください」ボタンをクリックして登録を続けてください。</p>
    <el-button 
      type="primary" 
      class="register-button" 
      style="width: 227px; margin-top: 20px;height: 32px;background-color: #409EFF;border: none;font-size: 14px;" 
      @click="handleContinue" 
      :disabled="isEmailSending" 
      :loading="isEmailSending"
    >
      {{ isEmailSending ? '送信中...' : 'クリックして登録を続行します' }}
    </el-button>
    <div class="line"></div>
    <p class="fontshow" style="text-align: left;">※電子メールに含まれる登録確認コードの有効期限は 15 分間です。有効期限が切れている場合は、メールアドレスを再度入力してください</p>
    <p>
      <em>
        <strong style="float: left;">※確認メールが届かない場合</strong>
        <br>
        <p class="fontshow">迷惑メールフォルダに振り分けられていることもありますのでご確認ください。また、[billerbeckgongstno3556@gmail.com]ドメインの受信を可能に設定してください。</p>
      </em>
    </p>
  </div>
  </div>
  </div>

</template>

<script setup>
import { ref, computed } from 'vue'
import { Promotion } from '@element-plus/icons-vue'
// import { ElIcon, ElIconMessage } from 'element-plus';

// 定义props
const props = defineProps({
  email: {
    type: String,
    required: true
  },
  isEmailSending: {
    type: Boolean,
    default: false
  },
  isSendingCode: {
    type: Boolean,
    default: false
  },
  countdown: {
    type: Number,
    default: 0
  }
})

// 定义emits
const emit = defineEmits(['continue', 'changeEmail', 'resendCode'])

// 计算验证码按钮文本
const codeButtonText = computed(() => {
  if (props.isSendingCode && props.countdown > 0) {
    return `${props.countdown}秒後に再試行`
  }
  return '重新发送'
})

// 处理继续注册
const handleContinue = () => {
  emit('continue')
}

// 处理更改邮箱
const handleChangeEmail = () => {
  emit('changeEmail')
}

// 处理重新发送验证码
const handleResendCode = () => {
  emit('resendCode')
}
</script>

<style scoped>
.register-content .register-left {
  transition: all 0.3s ease;
}

.register-content .register-left:only-child,
.register-content .register-left:nth-last-child(1):first-child {
  flex: 1 1 100%;
  max-width: 100%;
}
.register-left {
  flex: 1;
  padding: 30px;
  display: flex;
  flex-direction: column;
  margin-right: 0px;
  background-color: transparent;
  /* width: 100%; */
  /* min-height: 100vh; */

}
.logo {
  height: 60px;
  object-fit: contain;
}
.logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 15px;
}

.logo-container a {
  display: inline-block;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.logo-container a:hover {
  transform: scale(1.05);
}
.register-box {
  width: 100%;
  max-width: 1152.49px;
  margin: 0 auto;
  background-color: rgb(255, 255, 255);
  padding: 30px;
  border-radius: 8px;
  /* margin-left: 10px; */
}
.register-title {
  font: 700 22px / 1 "Hiragino Kaku Gothic Pro", sans-serif;
  color: #353d48;
  margin: 5px 0px 15px 0;
  text-align: center;
}
.email-sent-container {
  text-align: center;
  padding: 20px;
}

.email-sent-icon {
  font-size: 48px;
  color: #409eff;
  margin-bottom: 20px;
}
.email-login-subtext{
    color: #353d48;
    font: 700 16px / 1.8 "Hiragino Kaku Gothic Pro", sans-serif;
    margin: 0;
}
.email-sent-title {
  font-size: 20px;
  color: #333;
  margin-bottom: 10px;
}

.email-sent-text {
  font-size: 16px;
  color: #666;
  margin-bottom: 10px;
}

.email-sent-subtext {
  font-size: 14px;
  color: #999;
  margin-bottom: 20px;
}

.fontshow {
  text-align: center;
  margin: 10px 0;
  color: #606266;
  font-size: 14px;
}

.line {
  border-top: 2px solid #dcdfe6;
  margin: 20px 0;
  width: 100%;
}
.register-options {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.change-email-btn,
.resend-code-btn {
  color: #409eff;
  font-size: 14px;
}

.change-email-btn:hover,
.resend-code-btn:hover {
  color: #66b1ff;
}
.register-subtitle{
    color: #006ab6;
    font: 700 22px / 1 "Hiragino Kaku Gothic Pro", sans-serif;
    margin: 0;
    text-align: center;
}
/* 移动端响应式样式 - 最优化版本 */
@media (max-width: 768px) {
  .register-left {
    width: 100%;
    padding: 0;
  }

  .logo-container {
    margin-bottom: 10px;
  }

  .logo {
    height: 50px;
  }

  .register-box {
    max-width: 100%;
    padding: 20px 15px;
    margin-left: 100px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  }

  .register-title {
    font-size: 18px;
    margin-bottom: 12px;
  }

  .email-sent-container {
    padding: 15px 10px;
  }

  .email-sent-icon {
    font-size: 40px;
    margin-bottom: 15px;
  }

  .email-sent-title {
    font-size: 18px;
    margin-bottom: 8px;
    line-height: 1.4;
  }

  .email-sent-text {
    font-size: 15px;
    margin-bottom: 8px;
    line-height: 1.5;
  }

  .email-sent-subtext {
    font-size: 13px;
    margin-bottom: 15px;
    line-height: 1.4;
  }

  .fontshow {
    font-size: 13px;
    margin: 8px 0;
    line-height: 1.5;
  }

  .line {
    margin: 15px 0;
  }

  .register-button {
    height: 48px;
    font-size: 16px;
    border-radius: 8px;
    font-weight: 500;
  }

  .register-options {
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
    align-items: center;
  }

  .change-email-btn,
  .resend-code-btn {
    font-size: 14px;
    padding: 8px 16px;
    min-height: 36px;
    border-radius: 6px;
    width: 100%;
    max-width: 200px;
  }
}

/* 小屏幕手机端优化 */
@media (max-width: 480px) {
  .register-box {
    padding: 15px 12px;
    border-radius: 8px;
  }

  .register-title {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .email-sent-container {
    padding: 12px 8px;
  }

  .email-sent-icon {
    font-size: 36px;
    margin-bottom: 12px;
  }

  .email-sent-title {
    font-size: 16px;
    margin-bottom: 6px;
  }

  .email-sent-text {
    font-size: 14px;
    margin-bottom: 6px;
  }

  .email-sent-subtext {
    font-size: 12px;
    margin-bottom: 12px;
  }

  .fontshow {
    font-size: 12px;
    margin: 6px 0;
  }

  .register-button {
    height: 44px;
    font-size: 15px;
  }

  .change-email-btn,
  .resend-code-btn {
    font-size: 13px;
    min-height: 34px;
  }
}

/* 平板端优化 */
@media (min-width: 769px) and (max-width: 1024px) {
  .register-box {
    max-width: 600px;
    padding: 25px 20px;
    border-radius: 10px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.1);
  }

  .register-title {
    font-size: 19px;
  }

  .email-sent-container {
    padding: 18px 15px;
  }

  .email-sent-icon {
    font-size: 44px;
  }

  .email-sent-title {
    font-size: 19px;
  }

  .email-sent-text {
    font-size: 15px;
  }

  .fontshow {
    font-size: 13px;
  }

  .register-button {
    height: 46px;
    font-size: 15px;
  }

  .register-options {
    gap: 15px;
  }

  .change-email-btn,
  .resend-code-btn {
    font-size: 13px;
    max-width: 180px;
  }
}
</style>